import { h, resolveComponent } from "vue";
const routerView = {
  render: () => h(resolveComponent("router-view")),
};
import subMenu from "../layout/";

// 菜单栏路由
export const routerList = [
  {
    path: "/home",
    name: "home",
    component: () => import("@/views/Home/index.vue"),
    meta: {
      title: "首页",
      icon: "icon-xiazai44",
    },
  },
  {
    path: "/goods",
    name: "goods",
    component: () => routerView,
    meta: {
      title: "商品管理",
      icon: "icon-shangpinguanli",
    },
    redirect: "/goods_list",
    children: [
      {
        path: "/goods_list",
        name: "goods_list",
        component: () => import("@/views/Goods/goods_list.vue"),
        meta: {
          title: "商品列表",
          icon: "icon-shangpinliebiao1",
        },
      },
      {
        path: "/goods_release",
        name: "goods_release",
        component: () => import("@/views/Goods/goods_release.vue"),
        meta: {
          title: "商品发布",
          icon: "icon-shangpinfabu",
        },
      },
      {
        path: "/goods_category",
        name: "goods_category",
        component: () => import("@/views/Goods/goods_category.vue"),
        meta: {
          title: "分类管理",
          icon: "icon-shangpinfabu",
        },
      },
    ],
  },
  {
    path: "/user",
    name: "user",
    component: () => routerView,
    meta: {
      title: "用户管理",
      icon: "icon-yonghuguanli",
    },
    redirect: "/user_list",
    children: [
      {
        path: "/user_list",
        name: "user_list",
        component: () => import("@/views/User/user_list.vue"),
        meta: {
          title: "用户列表",
          icon: "icon-s_yonghuliebiao",
        },
      },
      {
        path: "/user_role",
        name: "user_role",
        component: () => import("@/views/User/user_role.vue"),
        meta: {
          title: "用户权限",
          icon: "icon-yonghuquanxian1",
        },
      },
    ],
  },
];
// 二级路由
export const subRouter = [
  {
    name: "edit",
    path: "/edit",
    redirect: "/goods_edit",
    component: () => subMenu,
    children: [
      {
        name: "goods_edit",
        path: "/goods_edit",
        component: () => import("@/views/Goods/goods_edit.vue"),
        meta: {
          title: "商品编辑",
        },
      },
      {
        name: "information",
        path: "/information",
        component: () => import("@/views/mine/information.vue"),
        meta: {
          title: "个人资料",
        },
      },
    ],
  },
];
